
public class Decider {
	public static String decide(DataModel data,DTNode node){
		if(node.edges.size() == 0){
			return node.value;
		}
		
		for(int i = 0;i< node.edges.size() ;i++){
			DTEdge edge = node.edges.get(i);
			if(edge.operator == '='){
				if(data.attrs.get(node.attr).equals(edge.value)){
					return decide(data,edge.to);
				}
			}else if(edge.operator == '<'){
				double dataV = Double.valueOf(data.attrs.get(node.attr));
				double dataE = Double.valueOf(edge.value);
				if(dataV <= dataE){
					return decide(data,edge.to);
				}
			}else if(edge.operator == '>'){
				double dataV = Double.valueOf(data.attrs.get(node.attr));
				double dataE = Double.valueOf(edge.value);
				if(dataV > dataE){
					return decide(data,edge.to);
				}
			}
		}
		return null;
	}
}
